package com.zz.admin.demo.mvcDemo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class MvcController {

    @RequestMapping(value = "/mvc", method = RequestMethod.GET)
    public String mvc() {
        return "MVC";
    }

    @RequestMapping(value = "/mvc/hello", method = RequestMethod.GET)
    public Map<String, String> hello(String name) {
        Map<String, String> result = new HashMap<>();
        result.put("hello", "world");
        result.put("author", name);
        return result;
    }

    public String getUserById(String id) {
        if ("1".equals(id)) {
            return "Tom";
        } else {
            return "Jerry";
        }
    }
}
